<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!--Description-->
    
        <meta name="description" content="jQuery   UI  ui的css,jq的js,ui的jsjQuery判断对象是否存在，返回的都是包装集（伪数组？）obj.length这样判断推荐使用mouseenter  不用mouseover因为mouseover会触发多次，或有事件冒泡的问题支持多条件选择器,—-条件:标签名,id,类样">
    

    <!--Author-->
    
        <meta name="author" content="John Doe">
    

    <!--Open Graph Title-->
    
        <meta property="og:title" content="jQuery"/>
    

    <!--Open Graph Description-->
    

    <!--Open Graph Site Name-->
    <meta property="og:site_name" content="Hexo"/>

    <!--Type page-->
    
        <meta property="og:type" content="article" />
    

    <!--Page Cover-->
    

        <meta name="twitter:card" content="summary" />
    

    <!-- Title -->
    
    <title>jQuery - Hexo</title>

    <!-- Bootstrap Core CSS -->
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/style.css">

    <!-- Custom Fonts -->
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Gallery -->
    <link href="//cdnjs.cloudflare.com/ajax/libs/featherlight/1.3.5/featherlight.min.css" type="text/css" rel="stylesheet" />

    <!-- Google Analytics -->
    


    <!-- favicon -->
    
	
</head>


<body>

    <!-- Menu -->
    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">逐风</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                
                    <li>
                        <a href="/">
                            
                                Home
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/archives">
                            
                                Archives
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/tags">
                            
                                Tags
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/categories">
                            
                                Categories
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="https://github.com/klugjo/hexo-theme-clean-blog">
                            
                                <i class="fa fa-github fa-stack-2x"></i>
                            
                        </a>
                    </li>
                
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

    <!-- Main Content -->
    <!-- Page Header -->
<!-- Set your background image for this header in your post front-matter: cover -->

<header class="intro-header" style="background-image: url('http://www.codeblocq.com/assets/projects/hexo-theme-clean-blog/img/home-bg.jpg')">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <h1>jQuery</h1>
                    
                    <span class="meta">
                        <!-- Date and Author -->
                        
                        
                            2016-09-10
                        
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

            <!-- Tags and categories -->
           

            <!-- Gallery -->
            

            <!-- Post Main Content -->
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <p>jQuery   UI  ui的css,jq的js,ui的js<br>jQuery判断对象是否存在，返回的都是包装集（伪数组？）obj.length这样判断<br>推荐使用mouseenter  不用mouseover因为mouseover会触发多次，或有事件冒泡的问题<br>支持多条件选择器,—-条件:标签名,id,类样式名字…<br>$(“p,span,.cls”)<br>：eq(4)—第五个元素<br>：lt(4)—小于索引4的元素<br>：gt(4)—大于索引4的元素<br>jQuery操作类名toggleClass addClass   removeClass    DOM操作类名 className=’’  removeAttribute(‘class’)<br>show和hide方法</p>
<pre><code>* show(参数1,参数2);
* hide(参数1,参数2);
* slideUp();滑上---隐藏
* slideDown();滑下---显示
* slideToggle();切换的滑入和滑出
* fadeIn();淡入
* fadeOut();淡出
* fadeToggle();切换的淡入淡出
* fadeTo();
* 参数1:这个参数的类型可以是数字类型,也可以是字符串类型:
* 数字类型:是时间---1000---1秒--1000毫秒,
* 字符串类型:fast,normal,slow---固定的三个
*
* 参数2:回调函数,这个函数是在动画执行结束后才执行
</code></pre><p>  .animate(样式改变，时间，函数)</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">//全选和全不选</div><div class="line">//一般非选中的属性使用attr方法，否则建议使用.prop方法</div><div class="line">   $(&quot;#j_cbAll&quot;).click(function () &#123;</div><div class="line">     //获取下面所有的复选框</div><div class="line">     $(&quot;#j_tb input&quot;).prop(&quot;checked&quot;,$(this).prop(&quot;checked&quot;));</div><div class="line">   &#125;);</div><div class="line"></div><div class="line">   //设置下面的复选框选中,然后是否决定上面的复选框选中</div><div class="line">   $(&quot;#j_tb input&quot;).click(function () &#123;</div><div class="line">     //获取下面的所有的复选框的个数</div><div class="line">     var length1=$(&quot;#j_tb input&quot;).length;</div><div class="line">     //获取下面的所有的选中的复选框的个数</div><div class="line">     var length2=$(&quot;#j_tb input:checked&quot;).length;</div><div class="line">     $(&quot;#j_cbAll&quot;).prop(&quot;checked&quot;,length1==length2);</div></pre></td></tr></table></figure>
<pre><code>    bind方法绑定事件
* delegate绑定事件
* on绑定事件
*
* 推荐用on
</code></pre><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div></pre></td><td class="code"><pre><div class="line">事件触发</div><div class="line">&lt;!DOCTYPE html&gt;</div><div class="line">&lt;html lang=&quot;en&quot;&gt;</div><div class="line">&lt;head&gt;</div><div class="line">  &lt;meta charset=&quot;UTF-8&quot;&gt;</div><div class="line">  &lt;title&gt;Title&lt;/title&gt;</div><div class="line">  &lt;script src=&quot;jquery-1.12.1.js&quot;&gt;&lt;/script&gt;</div><div class="line">  &lt;script&gt;</div><div class="line"></div><div class="line">    $(function () &#123;</div><div class="line">      //文本框注册获取焦点的事件</div><div class="line">      $(&quot;#txt&quot;).focus(function () &#123;</div><div class="line">        $(this).next().text(&quot;获取焦点了&quot;);</div><div class="line">      &#125;);</div><div class="line"></div><div class="line">      //点击按钮触发文本框的获取焦点的事件</div><div class="line"></div><div class="line">      $(&quot;#btn&quot;).click(function () &#123;</div><div class="line">        //触发文本框的获取焦点的事件</div><div class="line"></div><div class="line">        //$(&quot;#txt&quot;).focus();</div><div class="line">        //</div><div class="line">        //$(&quot;#txt&quot;).trigger(&quot;focus&quot;);</div><div class="line">        //前两种都会触发事件,也会触发浏览器的默认的行为</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line">        //下面这种方式可以触发事件,但是不会触发浏览器的默认行为</div><div class="line">        $(&quot;#txt&quot;).triggerHandler(&quot;focus&quot;);</div><div class="line">      &#125;);</div><div class="line">    &#125;);</div><div class="line"></div><div class="line">  &lt;/script&gt;</div><div class="line"></div><div class="line">&lt;/head&gt;</div><div class="line">&lt;body&gt;</div><div class="line">&lt;input type=&quot;button&quot; value=&quot;文本框获取焦点&quot; id=&quot;btn&quot;/&gt;&lt;br /&gt;</div><div class="line">&lt;input type=&quot;text&quot; value=&quot;&quot; id=&quot;txt&quot;/&gt;&lt;span&gt;&lt;/span&gt;</div><div class="line"></div><div class="line">&lt;/body&gt;</div><div class="line">&lt;/html&gt;</div></pre></td></tr></table></figure>
<p>如果非要用多个库。。。引起顶级对象冲突，需要释放控制权，var xy=$.noConflict();<br>把jQuery中的顶级对象换成xy了</p>


                
            </div>

            <!-- Comments -->
            
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                    


                </div>
            
        </div>
    </div>
</article>

    <!-- Footer -->
    <hr />

<!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                    

                    

                    
                        <li>
                            <a href="https://github.com/klugjo/hexo-theme-clean-blog" target="_blank">
                                <span class="fa-stack fa-lg">
                                    <i class="fa fa-circle fa-stack-2x"></i>
                                    <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                    

                    

                    

                    
                </ul>
                <p class="copyright text-muted">&copy; 2018 John Doe<br></p>
                <p class="copyright text-muted">Original Theme <a target="_blank" href="http://startbootstrap.com/template-overviews/clean-blog/">Clean Blog</a> from <a href="http://startbootstrap.com/" target="_blank">Start Bootstrap</a></p>
                <p class="copyright text-muted">Adapted for <a target="_blank" href="https://hexo.io/">Hexo</a> by <a href="http://www.codeblocq.com/" target="_blank">Jonathan Klughertz</a></p>
            </div>
        </div>
    </div>
</footer>


    <!-- After footer scripts -->
    
<!-- jQuery -->
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>

<!-- Bootstrap -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<!-- Gallery -->
<script src="//cdnjs.cloudflare.com/ajax/libs/featherlight/1.3.5/featherlight.min.js" type="text/javascript" charset="utf-8"></script>

<!-- Disqus Comments -->



</body>

</html>